package model;

import java.io.File;
import java.io.Serializable;

/*
 * Stores people introduced in my gui.PersonFormPanel
 * */
public class Person implements Serializable {
	/**
	 * 2013.03.11 - Alejandro Alcaide When implementing the Serializable
	 * interface, it's important to include the serialVerUID because -if used in
	 * different platforms- the class may think the object is not the same and
	 * cause an exception
	 */
	private static final long serialVersionUID = -3628399134572341796L;
	/*
	 * Model variables declaration
	 */
	private static int count = 0;
	private int id, idCollateralClient;
	/*
	 * Form Variables declaration
	 */
	private String name, surname, colClient, mailDesc, telDesc;
	/*
	 * instead of the itCollateralPair, I will have a CollateralClient enum
	 */
	// private IdText itCollateralClient;
	private CollateralClient cc;
	private boolean isChkIndirectClient;

	// constructor for serializing and inserting
	public Person(String name, String surname, CollateralClient cc,
			boolean isChkIndirectClient) {
		this.id = count;
		count++;
		this.name = name;
		this.surname = surname;
		this.cc = cc;
		this.isChkIndirectClient = isChkIndirectClient;
	}

	// constructor for retrieving
	public Person(int id, String name, String surname, CollateralClient cc,
			boolean isChkIndirectClient) {
		// this line uses the upper constructor. it also sets the id, but i'll
		// override
		this(name, surname, cc, isChkIndirectClient);
		// ...overriding
		this.id = id;
	}

	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(int id) {
		this.id = id;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the surname
	 */
	public String getSurname() {
		return surname;
	}

	/**
	 * @param surname
	 *            the surname to set
	 */
	public void setSurname(String surname) {
		this.surname = surname;
	}

	/**
	 * @return the cc
	 */
	public CollateralClient getCc() {
		return cc;
	}

	/**
	 * @param cc
	 *            the cc to set
	 */
	public void setCc(CollateralClient cc) {
		this.cc = cc;
	}

	/**
	 * @return the isChkIndirectClient
	 */
	public boolean isChkIndirectClient() {
		return isChkIndirectClient;
	}

	/**
	 * @param isChkIndirectClient
	 *            the isChkIndirectClient to set
	 */
	public void setChkIndirectClient(boolean isChkIndirectClient) {
		this.isChkIndirectClient = isChkIndirectClient;
	}

	/**
	 * @return the idCollateralClient
	 */
	public int getIdCollateralClient() {
		return idCollateralClient;
	}

	/**
	 * @param idCollateralClient
	 *            the idCollateralClient to set
	 */
	public void setIdCollateralClient(int idCollateralClient) {
		this.idCollateralClient = idCollateralClient;
	}

	/**
	 * @return the colClient
	 */
	public String getColClient() {
		return colClient;
	}

	/**
	 * @param colClient
	 *            the colClient to set
	 */
	public void setColClient(String colClient) {
		this.colClient = colClient;
	}

	public String toString() {
		return ("id #" + getId() + ", named: " + getName() + " " + getSurname());
	}
}
